<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../libs/animate.css">
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #app{
            margin: 100px auto;
        }
        .item{
            width: 300px;
            height: 50px;
            text-align: center;
            line-height: 50px;
            border: 2px solid rgb(220, 127, 6);
            border-radius: 10px;
            display: inline-block;
            background-color: rgb(0, 171, 244);
            transition: 0.5s;
            
        }
        .item:hover{
            cursor: pointer;
        }
        .text{
            width: 300px;
            height: 200px;
            line-height: 200px;
            text-align: center;
            border: 2px solid rgb(220, 127, 6);
            border-radius: 10px;
            display: inline-block;
            margin-top: 50px;
            background-color: rgb(0, 171, 244);
            transition: 0.5s;
        }
        .title-active{
            border: 2px solid rgb(0, 171, 244);
            background-color: rgb(220, 127, 6);
            transform: scale(1.1);
        }


    </style>
    <script src="../libs/vue.js"></script>
</head>
<body>
    <div id="app">
        <div class="title">
            <!-- 要用v-bind绑定 -->
            <div class="item" @click="changeOne(0)":class="current==0?'title-active':''">原生绑定事件函数</div>
            <div class="item" @click="changeOne(1)" :class="current==1?'title-active':''">jQuery绑定</div>
            <div class="item" @click="changeOne(2)" :class="current===2?'title-active':''">jQuery事件委托</div>
        </div>
        <div class="content">
            <div class="text" :style="{opacity:current==0?'1':'0',width:current==0?'300px':'0'}">0级事件和2级事件</div>
            <div class="text" :style="{opacity:current==1?'1':'0',width:current==1?'300px':'0'}">jQuery绑定:on/off bind/unbind</div>
            <div class="text" :style="{opacity:current==2?'1':'0',width:current==2?'300px':'0'}">事件委托用on和delegate </div>
        </div>
        
        

    </div>
</body>
<script>
    const vm = new Vue({
        data:{
            current:0,
            show:true
        },
        methods:{
            changeOne(index){
                this.current = index;
            }
        }
    }).$mount("#app");
    
</script>
</html>